home *** CD-ROM | disk | FTP | other *** search
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` MegaScroller !
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` By Rich Davey (rich@fatal-design.com)
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- ` Music listened to while coding this
- ` Headrush CD 1 (HyperLogic Trance Mix)
- ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- sync rate 0
- sync on
- hide mouse
-
- ` os is the % the font will be increased by.
- ` Valid values are 2,4,5 and 10. Others will result in missing characters
- ` 2 is nice to read, 10 is massive! at least half a screen high.
- ` s = the speed of the scroller. 16 is very fast, 8 is nice, 4 smooth.
-
- os=2 : s=12
-
- ` Load up a font: ox and oy are the dimensions (pixel) of the font set
- ` Uncomment out a pair to see a new font in action!
-
- load bitmap "knight6.bmp",1
- ox=32 : oy=25
-
- `load bitmap "fresh.bmp",1
- `ox=32 : oy=25
-
- `load bitmap "geo_font.bmp",1
- `ox=32 : oy=30
-
- `load bitmap "dr_satan.bmp",1
- `ox=32 : oy=33
-
- `load bitmap "knight3.bmp",1
- `ox=32 : oy=32
-
- ` ----------------------------------------------------------------------
- ` This is where the fun starts... (see end for scroll text itself)
- ` ----------------------------------------------------------------------
-
- x=0 : y=0 : bw#=ox*os
-
- ` rip the font from the BMP into seperate images
-
- for i=1 to 60
-
- get image i,x,y,x+ox,y+oy
- inc x,ox
-
- if x>=319
- x=0
- inc y,oy
- endif
-
- sync
-
- next i
-
- i=1
-
- ` create a new working environment
-
- create bitmap 2,640,480
-
- ` this scales and pastes the font to make the enlarged version
-
- if os>1
-
- for z=61 to 120
-
- create bitmap 1,ox*os,oy*os
- paste image i,0,0
- set current bitmap 2
- copy bitmap 1,0,0,ox,oy,2,0,0,ox*os+os,oy*os
- get image z,0,0,ox*os+os,oy*os
- inc i
-
- next z
-
- else
-
- print "Cannot have OS size less than 2"
- end
-
- endif
-
- set current bitmap 0
- delete bitmap 2
-
- bc=640/bw#+1
-
- ` pad out the initial text for a screens width
-
- for a=1 to bc
-
- st$=st$+" "
-
- next a
-
- ` read in the text data and check the length
-
- read s$
- st$=st$+s$
- lot=len(st$)+1
- if lot<12 then st$=st$+" "
-
- dim x#(bc)
- dim t$(bc)
-
- ` we're using 2 arrays to keep track of things. One (x) holds the x
- ` coords of the sprites as they move. The other the current letter of
- ` that sprite.
-
- for a=1 to bc
-
- x#(a)=bw#*a
- t$(a)=mid$(st$,a)
- as=asc(t$(a))
- sprite a,x#(a),0,29+as
- set sprite a,0,1
-
- next a
-
- ` just a bit of math to centre the font on-screen based on its height
-
- y=(480-oy*os)/2 : t=bc
-
- do
-
- cls 0
-
- ` this moves each sprite left, checks to see if its off the screen and
- ` then assigns it the next letter from the scroll text if it is
-
- for a=1 to bc
-
- x#=x#(a)
-
- dec x#,s
-
- if x#=<-0-bw#
- x#(a)=640
- inc t
-
- if t=lot
- t=1
- read st$
- if st$="*"
- restore
- read st$
- endif
- lot=len(st$)+1
- endif
-
- t$(a)=mid$(st$,t)
- else
- x#(a)=x#
- endif
-
- as=asc(t$(a))
- sprite a,x#(a),y,29+as
-
- next a
-
- sync
-
- loop
-
- ` and here is the actual text itself...
- ` placed into a data set because you will overflow a string buffer
- ` after only 3 lines of normal text otherwise! which would make for a
- ` rather dull and short scrolly :-)
-
- ` we use a single * as the end of text delimeter - don't forget it!
-
- data "DARKFORGE IS PROUD TO RELEASE IT'S MEGASCROLLER CODE! ... "
- data "CODED IN JULY 2000 FOR THE DARKBASIC MASSES. THIS CODE IS "
- data "UNIQUE IN THAT IT DOESN'T USE MASSIVE BITMAPS OR 3D ! "
- data "PUBLIC DOMAIN AS ALWAYS... AND NOW, WHAT SCROLLER WOULD BE "
- data "COMPLETE WITHOUT SOME GREETINGS??! ... "
- data "KUDOS FLY OUT TO.. TRACER! (THE SMOKING DRINKING CODING MASTER), "
- data "LEE (MAY WE BOW TO YOU!), PJAY, SI, WARPY, CHRIS AND THE REST OF "
- data "THE MOB ON IRC.CJB.NET ! THIS IS RICH DOING THAT WRAP THING "
- data ".......... "
- data "*"
-
-